FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY src/PithyDesign.Web/PithyDesign.Web.csproj src/PithyDesign.Web/
COPY src/PithyDesign.EntityFrameworkCore/PithyDesign.EntityFrameworkCore.csproj src/PithyDesign.EntityFrameworkCore/
COPY src/PithyDesign.Core/PithyDesign.Core.csproj src/PithyDesign.Core/
COPY src/PithyDesign.Application/PithyDesign.Application.csproj src/PithyDesign.Application/
RUN dotnet restore src/PithyDesign.Web/PithyDesign.Web.csproj
COPY . .
WORKDIR /src/src/PithyDesign.Web
RUN dotnet build PithyDesign.Web.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish PithyDesign.Web.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "PithyDesign.Web.dll"]
